package com.zto.design.command;

/**
 * @program: sch-diy-parent
 * @description:
 * @author: sch
 * @create: 2020-11-28 19:39
 **/
public class Client {
    public Client() {
        Receiver receiver = new Receiver();
        receiver.doA();
        receiver.doB();
    }

    public static void main(String[] args) {
        Receiver receiver1 = new Receiver();
        ConcreteCommandA concreteCommandA = new ConcreteCommandA(receiver1);
        concreteCommandA.execute();
        System.out.println("---------------------------");
        Receiver receiver = new Receiver();
        Invoker invoker = new Invoker();
        invoker.setCommand(new ConcreteCommandA(receiver));
        invoker.runCommand();

        invoker.setCommand(new ConcreteCommandB(receiver));
        invoker.runCommand();
    }
}
